//
//  myCell.m
//  BeautyClother
//
//  Created by dllo on 15/8/21.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "myCell.h"

@interface myCell ()

@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@property (nonatomic, retain) UIView *my;

@end

@implementation myCell



- (void)dealloc
{
    [_image release];
    [_source release];
    [_title release];
    [_date release];
    [_comment release];
    [_like release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        self.my = [[UIView alloc]init];
        self.image = [[UIImageView alloc]init];
        [self.my addSubview:self.image];
        [self.image release];
        
        self.source = [[UILabel alloc]init];
        [self.my addSubview:self.source];
        [self.source release];
        
        self.title = [[UILabel alloc]init];
        [self.my addSubview:self.title];
        [self.title release];
        
        self.date = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.date];
        
        self.comment = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.comment];
        
        self.like = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.like];
        
        self.my.frame = CGRectMake(5 *_offWidth, 0, self.frame.size.width - 10 *_offWidth, self.frame.size.height);
        self.layer.cornerRadius = 2;
        self.layer.masksToBounds = YES;
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.my.frame = CGRectMake(5 *_offWidth, 0, self.frame.size.width - 10 *_offWidth, self.frame.size.height);
    self.my.layer.cornerRadius = 8;
    self.my.layer.masksToBounds = YES;
    self.my.backgroundColor = [UIColor colorWithRed:187 / 255 green:255 / 255 blue:255 /255 alpha:0.1];
    [self.contentView addSubview:self.my];
    self.image.frame = CGRectMake(0, 0, self.frame.size.width - 10 * _offWidth, 150 *_offHeight);
    
    
    self.source.frame = CGRectMake(10 *_offWidth, 150 *_offHeight, 80 *_offWidth, 30 *_offHeight);
    self.source.textColor = [UIColor colorWithRed:255 /255 green:0 blue:255 / 255 alpha:1];
    
    self.title.frame = CGRectMake(80 *_offWidth, 150 *_offHeight, self.frame.size.width - 80 *_offWidth, 30 *_offHeight);
    self.title.textColor = [UIColor darkGrayColor];
    
    self.date.frame = CGRectMake(5 *_offWidth, 180 *_offHeight, 90 * _offWidth, 20 *_offHeight);
    [self.date setImage:[UIImage imageNamed:@"clock.png"] forState:UIControlStateNormal];
    self.date.titleLabel.font = [UIFont systemFontOfSize:10];
    [self.date setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.date.tintColor = [UIColor darkGrayColor];
    self.comment.frame = CGRectMake(260 *_offWidth, 180 *_offHeight, 40 *_offWidth, 20 *_offHeight);
    [self.comment setImage:[UIImage imageNamed:@"v.png"] forState:UIControlStateNormal];
    self.comment.titleLabel.font = [UIFont systemFontOfSize:10];
    [self.comment setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.comment.tintColor = [UIColor darkGrayColor];
    self.like.frame = CGRectMake(300 *_offWidth, 180 *_offHeight, 70 *_offWidth, 20*_offHeight);
    [self.like setImage:[UIImage imageNamed:@"comm.png.png"] forState:UIControlStateNormal];
    self.like.titleLabel.font = [UIFont systemFontOfSize:10];
    [self.like setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.like.tintColor = [UIColor darkGrayColor];
    UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(10 *_offWidth, 177 *_offHeight, self.frame.size.width - 20 *_offWidth, 0.5)];
    [self.my addSubview:line];
    line.backgroundColor = [UIColor lightGrayColor];
    [line release];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
